/*
 * @lc app=leetcode.cn id=1925 lang=typescript
 *
 * [1925] 统计平方和三元组的数目
 */

// @lc code=start
function countTriples(n: number): number {
    let count = 0;
    for (let i = 0; i < n; i++) {
        for (let j = i + 1; j < n; j++) {
            let c = Math.sqrt(i ** 2 + j ** 2);
            if (c <= n && c > j && c % 1 === 0) {
                count++;
            }
        }
    }
    return count * 2;
}
// @lc code=end
